<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>日志信息</title>
  <meta name="renderer" content="webkit"> 
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">  
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"> 
  <meta name="apple-mobile-web-app-status-bar-style" content="black"> 
  <meta name="apple-mobile-web-app-capable" content="yes">  
  <meta name="format-detection" content="telephone=no"> 
  <link rel="stylesheet" type="text/css" href="__ADMIN__/layui/css/layui.css" media="all">
  <link rel="stylesheet" type="text/css" href="__ADMIN__/bootstrap/css/bootstrap.css" media="all">
  <link rel="stylesheet" type="text/css" href="__ADMIN__/global.css" media="all">
  <link rel="stylesheet" type="text/css" href="__ADMIN__/css/personal.css" media="all">
  <link rel="stylesheet" type="text/css" href="__ADMIN__/css/page.css" media="all">
  <script type="text/javascript" src="__ADMIN__/jedate/jquery-1.7.2.js"></script>
</head>
<body>
<section class="layui-larry-box">
  <div class="larry-personal">
      <div class="layui-tab">
        <blockquote class="layui-elem-quote mylog-info-tit">
          <ul class="layui-tab-title">
            <li class="layui-btn layui-this"><i class="layui-icon">&#xe60a;</i>我的操作日志</li>
            <auth rule="logs/del" fullrule="true" >
            <span onclick="if (confirm('您确定清空日志吗？')) return true; else return false;"><a  style="margin:-35px;margin-right:0px;" href="/admin/Logs/del" class="layui-btn layui-btn-small larry-log-del"><i class="iconfont icon-huishouzhan1"></i>清空日志</a></span>
          </auth>
          </ul>
        </blockquote>
        <form action="__URL__/index" method="get">
          <blockquote class="layui-elem-quote">
          <div class="layui-form-item">
            <div class="layui-inline">
            <label class="layui-form-label"></label>
              <div class="layui-input-inline">
               <input class="layui-input" name="module" placeholder="控制器"  />
              </div>
            </div>
            <div class="layui-inline">
              <input name="begintime" class="layui-input" placeholder="开始时间" onclick="layui.laydate({elem: this, festival: true})">
            </div>
            <div class="layui-inline">
              <input name="endtime" class="layui-input" placeholder="结束时间" onclick="layui.laydate({elem: this, festival: true})">
            </div>
            <div class="layui-inline">
              <div class="layui-input-inline">
                <input class="layui-btn" lay-submit="" lay-filter="demo1" type="submit" value="搜索">
              </div>
            </div>
        </div>
        </blockquote>
      </form>
      <div class="larry-separate"></div>
        <div class="layui-tab-content larry-personal-body clearfix mylog-info-box">
        <!-- 操作日志 -->
          <div class="layui-tab-item layui-field-box layui-show">
            <table class="layui-table table-hover" lay-even="" lay-skin="nob">
              <thead>
                <tr>
                  <th><input class="all" type="checkbox" id="selected-all" ></th>
                  <th>ID</th>
                  <th>操作人</th>
                  <th>模块</th>
                  <th>控制器</th>
                  <th>操作</th>
                  <th>IP</th>
                  <th>时间</th>
                </tr>
              </thead>
              <tbody>
               <volist name="logs" id="vo">
                <tr>
                  <td><input class="allcheck" type="checkbox" value="{$vo.logid}"></td>
                  <td>{$vo.logid}</td>
                  <td>{$vo.username}</td>
                  <td>{$vo.module}</td>
                  <td>{$vo.action}</td>
                  <td>{$vo.querystring}</td>
                  <td>{$vo.ip}</td>
                  <td>{$vo.time|date="Y-m-d H:i:s",###}</td>
                </tr>
               </volist> 
              </tbody>
            </table>
            <div class="larry-table-page clearfix">
              <auth rule="logs/dodel" fullrule="true" >
              <a href="javascript:void(0)" id="del" class="layui-btn layui-btn-small"><i class="iconfont icon-shanchu1"></i>删除</a>
              </auth>
              <div id="page" class="green-black">{$page}</div>
            </div>
          </div>
        </div>
    </div>
  </div>
</section>
<script type="text/javascript" src="__ADMIN__/layui/layui.js"></script>

<script type="text/javascript">
/*--------绑定全选事件-------*/
$(".all").click(function(){
  //获取选择状态
  var check=$(this).attr("checked");
  if(check==undefined){
    $("input[type=checkbox]").attr("checked",false);
  }else{
    $("input[type=checkbox]").attr("checked",check);
  }
})
/*--------获取删除 绑定单击事件-------*/
$('#del').click(function(){
  a=[];/*-----存储选中数据的ID------*/
  b=0;
  $(':checkbox').each(function(){
    /*--------判断是否被选中---------*/
    if($(this).attr('checked')){
      /*------获取id-------*/
      id=$(this).val();
      a.push(id);//把获取到的id放到a数组中
      b=1;
    }

  })
  //判断管理员是否选择操作日志
  if(b==1){
    if(confirm('您确定删除操作日志吗？')){
    $.get('{:U('Logs/dodel')}',{uid:a},function(data){
    if(data==1){
      /*------执行删除html的样式----------------*/
      for(var i=0;i<a.length;i++){
       //获取被选中的input框
       $("input[value="+a[i]+"]").parents('tr').remove();
      }
    }
   });

  }
}else{
  alert("请选择需要删除的操作日志");
}
  
});

layui.use('laydate', function(){
  var laydate = layui.laydate;
  
  var start = {
    min: laydate.now()
    ,max: '2099-06-16 23:59:59'
    ,istoday: false
    ,choose: function(datas){
      end.min = datas; //开始日选好后，重置结束日的最小日期
      end.start = datas //将结束日的初始值设定为开始日
    }
  };
  
  var end = {
    min: laydate.now()
    ,max: '2099-06-16 23:59:59'
    ,istoday: false
    ,choose: function(datas){
      start.max = datas; //结束日选好后，重置开始日的最大日期
    }
  };
  
  document.getElementById('LAY_demorange_s').onclick = function(){
    start.elem = this;
    laydate(start);
  }
  document.getElementById('LAY_demorange_e').onclick = function(){
    end.elem = this
    laydate(end);
  }
  
});

</script>
</body>
</html>